﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using PPI.Entities.Interface;
using PPI.Entities.XML;

namespace PPI.Client.Logic.Upload
{
    public abstract class LUploadStrategyBase : IUpload
    {
        protected bool m_HasErrors;

        public LUploadStrategyBase (EXmlOutboxBase outbox)
        {
            m_OutboxDatabase = outbox;
            m_HasErrors = false;
        }

        protected EXmlOutboxBase m_OutboxDatabase;
        public EXmlOutboxBase OutboxDatabase
        {
            get { return m_OutboxDatabase; }
        }

        public abstract void StartWork(BackgroundWorker worker, DoWorkEventArgs workerEvents);
        public abstract void FinishWork();
        protected int ReportProgress(int countUpload, int totalUpload)
        {
            int _Progress;
            try
            {
                _Progress = ((totalUpload - countUpload) * 100) / totalUpload;
            }
            catch (Exception)
            {
                _Progress = 0;
            }
            return _Progress;
        }
    }
}
